package dto;

import java.util.Date;

public class VoteDTO {
		private int idVote;
		private CitizenDTO citizen;
		private ElectionDTO election;
		private PartyDTO party;
		private Date dateVote;
		
		private MemberDTO preference1;
		private MemberDTO preference2;
		private MemberDTO preference3;
		
		private MemberDTO[] memberElectionVotes;
		public CitizenDTO getCitizen() {
			return citizen;
		}
		public void setCitizen(CitizenDTO citizen) {
			this.citizen = citizen;
		}
		public int getIdVote() {
			return idVote;
		}
		public void setIdVote(int idVote) {
			this.idVote = idVote;
		}
		public ElectionDTO getElection() {
			return election;
		}
		public void setElection(ElectionDTO election) {
			this.election = election;
		}
		public PartyDTO getParty() {
			return party;
		}
		public void setParty(PartyDTO party) {
			this.party = party;
		}
		public MemberDTO getPreference1() {
			return preference1;
		}
		public void setPreference1(MemberDTO preference1) {
			this.preference1 = preference1;
		}
		public MemberDTO getPreference2() {
			return preference2;
		}
		public void setPreference2(MemberDTO preference2) {
			this.preference2 = preference2;
		}
		public MemberDTO getPreference3() {
			return preference3;
		}
		public void setPreference3(MemberDTO preference3) {
			this.preference3 = preference3;
		}
		public MemberDTO[] getMemberElectionVotes() {
			if (memberElectionVotes == null){
				memberElectionVotes = new MemberDTO[3];
			}
			return memberElectionVotes;
		}
		public void setMemberElectionVotes(MemberDTO[] memberElectionVotes) {
			this.memberElectionVotes = memberElectionVotes;
		}
		public Date getDateVote() {
			return dateVote;
		}
		public void setDateVote(Date dateVote) {
			this.dateVote = dateVote;
		}
		public VoteDTO(CitizenDTO citizen, PartyDTO party, Date dateVote, MemberDTO... members){
			this.citizen = citizen;
			this.party = party;
			this.dateVote = dateVote;
			
			int min = members.length > 3 ? 3 : members.length;
			this.memberElectionVotes = new MemberDTO[min];
			
			for (int i = 0; i < min; i++){
				this.memberElectionVotes[i] = members[i];
			}
		}
		public VoteDTO() {
			// TODO Auto-generated constructor stub
		}
}
